/****************************************************************************
 Copyright (c) 2012-2012 lijiejun
 Copyright (c) 2010-2012 cocos2d-x.org
 Copyright (c) 2008-2010 Ricardo Quesada
 Copyright (c) 2011      Zynga Inc.
 
 http://www.cocos2d-x.org
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 in the Software without restriction, including without limitation the rights
 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 copies of the Software, and to permit persons to whom the Software is
 furnished to do so, subject to the following conditions:
 
 The above copyright notice and this permission notice shall be included in
 all copies or substantial portions of the Software.
 
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 ****************************************************************************/

package org.cocos2d.actions
{
	import org.cocos2d.basenodes.CCNode;
	import org.cocos2d.cocoa.CCObject;
	import org.cocos2d.cocoa.CCZone;
	import org.cocos2d.platform.CCLog;
	
	const kCCActionTagInvalid : int = -1;
	
	public class CCAction extends CCObject
	{
		public function CCAction()
		{
			m_pOriginalTarget = null;
			m_pTarget = null;
			m_nTag = kCCActionTagInvalid;
		}
		
		public function description() : String
		{
			return "<CCAction | Tag = " + m_nTag.toString() + ">";
		}
		
		public override function copyWithZone(pZone : CCZone) : CCObject
		{
			var pNewZone : CCZone = null;
			var pRet : CCAction = null;
			if (pZone && pZone.m_pCopyObject)
			{
				return pZone.m_pCopyObject as CCAction;
			}
			else
			{
				pRet = new CCAction();
				pZone = pNewZone = new CCZone(pRet);
			}
			
			pRet.m_nTag = m_nTag;
			
			return pRet;
		}
		
		public function isDone() : Boolean
		{
			return true;	
		}
		
		public function startWithTarget(aTarget : CCNode) : void
		{
			m_pOriginalTarget = m_pTarget = aTarget;
		}
		
		public function stop() : void
		{
			m_pTarget = null;
		}
		
		public function step(dt : Number) : void
		{
			CCLog.Log("[Action step]. override me");
		}
		
		public function update(time : Number) : void
		{
			CCLog.Log("[Action update]. override me");
		}
		
		public function get Target() : CCNode
		{
			return m_pTarget;
		}
		
		public function set Target(pTarget : CCNode) : void
		{
			m_pTarget = pTarget;
		}
		
		public function get OriginalTarget() : CCNode
		{
			return m_pOriginalTarget;
		}
		
		public function set OriginalTarget(pOriginalTarget : CCNode) : void
		{
			m_pOriginalTarget = pOriginalTarget;
		}
		
		public function get Tag() : int
		{
			return m_nTag;
		}
		
		public function set Tag(nTag : int) : void
		{
			m_nTag = nTag;
		}
		
		[Deprecated]
		public static function action() : CCAction
		{
			return CCAction.create();
		}
		
		public static function create() : CCAction
		{
			var pRet : CCAction = new CCAction();
			return pRet;
		}
		
		
		protected var m_pOriginalTarget : CCNode;
		protected var m_pTarget : CCNode;
		protected var m_nTag : int;
	}
}